# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=usbrip
pkgver=291.5093c84
pkgrel=6
pkgdesc='USB device artifacts tracker.'
groups=('blackarch' 'blackarch-forensic')
arch=('any')
url='https://github.com/snovvcrash/usbrip'
license=('GPL3')
depends=('python' 'python-termcolor' 'python-terminaltables' 'python-wheel'
         'python-tqdm')
makedepends=('git' 'python-pip' 'python-setuptools')
source=("$pkgname::git+https://github.com/snovvcrash/$pkgname.git"
        'setup.py.patch')
sha512sums=('SKIP'
            'cc8aff229efa065f456788ad5e3d2a22081cbbaa276de9ae9676949ccc1543940971525c199f6012015d2ee23e88cfa2d5d1753885b1ed2f35f5c2b798424cb9')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  patch -p1 < setup.py.patch
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf "$pkgdir/usr/"{README.md,requirements.txt}
}

